/**
 * @see[description](https://docs.alipay.com/mini/api/ui-navigate)
 * 设置导航栏文字及样式
 * @example set_navigation_bar('你好','https://images.gitee.com/uploads/69/1961669_xiapeixu.png?1530761784','#108ee9');
 */
export default function set_navigation_bar(title?: string, image?: string, backgroundColor?: string, borderBottomColor?: string, reset?: boolean) {
	const options = {};
	if (title !== undefined) {
		Object.assign(options, {
			title
		});
	}
	if (image !== undefined) {
		Object.assign(options, {
			image
		});
	}
	if (backgroundColor !== undefined) {
		Object.assign(options, {
			backgroundColor
		});
	}
	if (borderBottomColor !== undefined) {
		Object.assign(options, {
			borderBottomColor
		});
	}
	if (reset !== undefined) {
		Object.assign(options, {
			reset
		});
	}

	return new Promise<boolean>((resolve, _reject) => {
		my.setNavigationBar({
			...options,
			success() {
				resolve(true);
			},
			fail() {
				resolve(false);
			}
		});
	});
}
